use std::{
    io,
    time::{SystemTime, UNIX_EPOCH},
};

pub fn millisencodes_from(system_time: &io::Result<SystemTime>) -> i64 {
    match system_time {
        Ok(time) => match time.duration_since(UNIX_EPOCH) {
            Ok(duration) => duration.as_millis() as i64,
            Err(_) => 0,
        },
        Err(_) => 0,
    }
}
pub fn get_systemtime_millis() -> i64 {
    SystemTime::now().duration_since(UNIX_EPOCH).map_or(0, |v| v.as_millis() as i64)
}

pub static SECOND: i64 = 1000;
pub static MINUTE: i64 = SECOND * 60;
pub static HOUR: i64 = MINUTE * 60;
pub static DAY: i64 = HOUR * 24;
